using System;
using System.Data;
using System.ComponentModel;
using System.Reflection;
using System.Collections.Generic;
using DataObject.Helpers;

namespace DataObject.Model
{
    [Serializable]
    public class PaymentBatchDetailDTO : DTOBase
    {
        public PaymentBatchDetailDTO()
        {
            PaymentBatchDetailID = Helper.NewSeqGuid();
            ModifiedDate = DateTime.Now;
        }

        public string MethodN
        {
            get { return ((PaidMethodEnum)PaymentMethod).GetStringValue(); }
        }

        public string CreditCardN
        {
            get
            {
                if (CardType.HasValue && CardType >= 0)
                    return define.CreditCards[CardType.Value];
                return String.Empty;
            }
        }

        public string UnitPriceN
        {
            get
            {
                if (CurrencyAmount.HasValue && CurrencyAmount >= 0)
                    return ((CurrencyEnum)CurrencyAmount.Value).GetStringValue();
                return String.Empty;
            }
        }

        public string UnitFeeN
        {
            get
            {
                if (CurrencyFee == null) return String.Empty;
                else if (CurrencyFee == 0) return "%";
                else
                    return ((CurrencyEnum)(CurrencyFee.Value - 1)).GetStringValue();
            }
        }

        #region Reference property Members

        private PaymentBatchDTO _paymentBatch = new PaymentBatchDTO();
        public PaymentBatchDTO PaymentBatch
        {
            get
            {
                return _paymentBatch;
            }
            set
            {
                if (_paymentBatch != value)
                {
                    _paymentBatch = value;
                }
            }
        }

        #endregion

        #region Collection Members


        #endregion

        #region Property Active

        private bool _active;

        /// <summary>
        ///  Property Active
        /// <summary>
        public bool Active
        {
            get
            {
                return _active;
            }

            set
            {
                if (_active != value)
                {
                    this.OnActiveChanging(value);
                    _active = value;
                    this.OnActiveChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Amount

        private decimal _amount;

        /// <summary>
        ///  Property Amount
        /// <summary>
        public decimal Amount
        {
            get
            {
                return _amount;
            }

            set
            {
                if (_amount != value)
                {
                    this.OnAmountChanging(value);
                    _amount = value;
                    this.OnAmountChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property CardType

        private int? _cardType;

        /// <summary>
        ///  Property CardType
        /// <summary>
        public int? CardType
        {
            get
            {
                return _cardType;
            }

            set
            {
                if (_cardType != value)
                {
                    this.OnCardTypeChanging(value);
                    _cardType = value;
                    this.OnCardTypeChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property CurrencyAmount

        private int? _currencyAmount;

        /// <summary>
        ///  Property CurrencyAmount
        /// <summary>
        public int? CurrencyAmount
        {
            get
            {
                return _currencyAmount;
            }

            set
            {
                if (_currencyAmount != value)
                {
                    this.OnCurrencyAmountChanging(value);
                    _currencyAmount = value;
                    this.OnCurrencyAmountChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property CurrencyFee

        private int? _currencyFee;

        /// <summary>
        ///  Property CurrencyFee
        /// <summary>
        public int? CurrencyFee
        {
            get
            {
                return _currencyFee;
            }

            set
            {
                if (_currencyFee != value)
                {
                    this.OnCurrencyFeeChanging(value);
                    _currencyFee = value;
                    this.OnCurrencyFeeChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Fee

        private decimal _fee;

        /// <summary>
        ///  Property Fee
        /// <summary>
        public decimal Fee
        {
            get
            {
                return _fee;
            }

            set
            {
                if (_fee != value)
                {
                    this.OnFeeChanging(value);
                    _fee = value;
                    this.OnFeeChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property FeeRate

        private decimal _feeRate;

        /// <summary>
        ///  Property FeeRate
        /// <summary>
        public decimal FeeRate
        {
            get
            {
                return _feeRate;
            }

            set
            {
                if (_feeRate != value)
                {
                    this.OnFeeRateChanging(value);
                    _feeRate = value;
                    this.OnFeeRateChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ModifiedBy

        private string _modifiedBy;

        /// <summary>
        ///  Property ModifiedBy
        /// <summary>
        public string ModifiedBy
        {
            get
            {
                return _modifiedBy;
            }

            set
            {
                if (_modifiedBy != value)
                {
                    this.OnModifiedByChanging(value);
                    _modifiedBy = value;
                    this.OnModifiedByChanged();
                }
            }
        }

        #endregion

        #region Property ModifiedDate

        private DateTime? _modifiedDate;

        /// <summary>
        ///  Property ModifiedDate
        /// <summary>
        public DateTime? ModifiedDate
        {
            get
            {
                return _modifiedDate;
            }

            set
            {
                if (_modifiedDate != value)
                {
                    this.OnModifiedDateChanging(value);
                    _modifiedDate = value;
                    this.OnModifiedDateChanged();
                }
            }
        }

        #endregion

        #region Property PaymentBatchDetailID

        private Guid _paymentBatchDetailID;

        /// <summary>
        ///  Property PaymentBatchDetailID
        /// <summary>
        public Guid PaymentBatchDetailID
        {
            get
            {
                return _paymentBatchDetailID;
            }

            set
            {
                if (_paymentBatchDetailID != value)
                {
                    this.OnPaymentBatchDetailIDChanging(value);
                    _paymentBatchDetailID = value;
                    this.OnPaymentBatchDetailIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property PaymentBatchID

        private Guid _paymentBatchID;

        /// <summary>
        ///  Property PaymentBatchID
        /// <summary>
        public Guid PaymentBatchID
        {
            get
            {
                return _paymentBatchID;
            }

            set
            {
                if (_paymentBatchID != value)
                {
                    this.OnPaymentBatchIDChanging(value);
                    _paymentBatchID = value;
                    this.OnPaymentBatchIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property PaymentMethod

        private int _paymentMethod;

        /// <summary>
        ///  Property PaymentMethod
        /// <summary>
        public int PaymentMethod
        {
            get
            {
                return _paymentMethod;
            }

            set
            {
                if (_paymentMethod != value)
                {
                    this.OnPaymentMethodChanging(value);
                    _paymentMethod = value;
                    this.OnPaymentMethodChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Rate

        private decimal _rate;

        /// <summary>
        ///  Property Rate
        /// <summary>
        public decimal Rate
        {
            get
            {
                return _rate;
            }

            set
            {
                if (_rate != value)
                {
                    this.OnRateChanging(value);
                    _rate = value;
                    this.OnRateChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ReceivedBy

        private string _receivedBy;

        /// <summary>
        ///  Property ReceivedBy
        /// <summary>
        public string ReceivedBy
        {
            get
            {
                return _receivedBy;
            }

            set
            {
                if (_receivedBy != value)
                {
                    this.OnReceivedByChanging(value);
                    _receivedBy = value;
                    this.OnReceivedByChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Extensibility Method Declarations

        protected virtual void OnActiveChanging(bool active) { }
        protected virtual void OnActiveChanged() { }
        protected virtual void OnAmountChanging(decimal amount) { }
        protected virtual void OnAmountChanged() { }
        protected virtual void OnCardTypeChanging(int? cardType) { }
        protected virtual void OnCardTypeChanged() { }
        protected virtual void OnCurrencyAmountChanging(int? currencyAmount) { }
        protected virtual void OnCurrencyAmountChanged() { }
        protected virtual void OnCurrencyFeeChanging(int? currencyFee) { }
        protected virtual void OnCurrencyFeeChanged() { }
        protected virtual void OnFeeChanging(decimal fee) { }
        protected virtual void OnFeeChanged() { }
        protected virtual void OnFeeRateChanging(decimal feeRate) { }
        protected virtual void OnFeeRateChanged() { }
        protected virtual void OnModifiedByChanging(string modifiedBy) { }
        protected virtual void OnModifiedByChanged() { }
        protected virtual void OnModifiedDateChanging(DateTime? modifiedDate) { }
        protected virtual void OnModifiedDateChanged() { }
        protected virtual void OnPaymentBatchDetailIDChanging(Guid paymentBatchDetailID) { }
        protected virtual void OnPaymentBatchDetailIDChanged() { }
        protected virtual void OnPaymentBatchIDChanging(Guid paymentBatchID) { }
        protected virtual void OnPaymentBatchIDChanged() { }
        protected virtual void OnPaymentMethodChanging(int paymentMethod) { }
        protected virtual void OnPaymentMethodChanged() { }
        protected virtual void OnRateChanging(decimal rate) { }
        protected virtual void OnRateChanged() { }
        protected virtual void OnReceivedByChanging(string receivedBy) { }
        protected virtual void OnReceivedByChanged() { }

        #endregion

    }
}
